//
//  PCMeHeaderCell.m
//  PhotoCircle
//
//  Created by GL on 15/12/10.
//  Copyright © 2015年 wujungao. All rights reserved.
//

#import "PCMeHeaderCell.h"
#import "PCUserModel.h"

@interface PCMeHeaderCell()

@property (weak, nonatomic) IBOutlet UIImageView *headImageView;
@property (weak, nonatomic) IBOutlet UILabel *userName;
@property (weak, nonatomic) IBOutlet UILabel *integralLabel;

@end

@implementation PCMeHeaderCell

- (void)awakeFromNib {
    // Initialization code
    
    //设置圆角边框
    _headImageView.layer.cornerRadius = _headImageView.frame.size.width/2.0;
    _headImageView.layer.masksToBounds = YES;
    //设置边框及边框颜色
    _headImageView.layer.borderWidth = 1.0;
    _headImageView.layer.borderColor =[ [UIColor whiteColor] CGColor];
}

-(void)configCellWithUserModel:(PCUserModel*)uModel
{
    _headImageView.image = [UIImage imageWithData:uModel.userImageData];
    // 赋值
    if (uModel) {
        _userName.text = uModel.userName;
        if (uModel.userScore) {
            _integralLabel.text = [NSString stringWithFormat:@"积分: %@",uModel.userScore];
        }else{
            _integralLabel.text = @"积分: 0";
        }
        _integralLabel.hidden = NO;
    }else{
        _userName.text = @"点击登录";
        _integralLabel.hidden = YES;
    }
}

#pragma mark -
#pragma mark - Button Event
- (IBAction)registerEvent:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(selectedRegister)]) {
        [self.delegate selectedRegister];
    }
}

- (IBAction)loginEvent:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(selectedLogin)]) {
        [self.delegate selectedLogin];
    }
}

-(IBAction)clickHeaderImageView:(UITapGestureRecognizer*)tap{
    
    NSLog(@"clickHeaderImageView");
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}



@end
